<template>
    <div>
        <!-- 面包屑 -->
        <el-bread></el-bread>
        <!-- 添加按钮 -->
        <el-button class="addbtn" type="primary" plain size="small" @click="add">添加</el-button>
        <!-- 表格 -->
        <Tlist @edit="edit"></Tlist>
        <!-- 添加菜单弹框 -->
        <Dialog :isShow="isShow" :isAdd="isAdd" @cancel="cancel" ref="DiaRef"></Dialog>

        
    </div>
</template>
<script>
import Tlist from './Tlist.vue'
import  Dialog  from './dialog.vue';
export default {
    data() {
        return {
           isShow: false, //对话框状态显示还是隐藏
           isAdd:true //添加状态是添加还是编辑 默认为添加
        }
    },
    methods: {
        add(){
            this.isShow = true
            // isAdd为真时是添加菜单
            this.isAdd = true
        },
        cancel(e){//子传父关闭弹框
            this.isShow = e
        },
        edit(e){
            this.isShow = true
            // isAdd为假时是编辑菜单
            this.isAdd = false
            
            this.$refs.DiaRef.lookup(e)
           
        }
    },
    mounted() {
    },
    components: { Tlist,Dialog}
}
</script>
<style scoped>
.addbtn {
    margin: 10px;
}
</style>